
# y(n) = b₀x(n) + b₁x(n-1) + b₂x(n-1) - a₁y(n-1) - a₂y(n-2)
# biquad - resonance filter


# generate basic waves

LENGTH: con 256;
halfwave(): array of real
{
	b := array[LENGTH] of { * => 0.0};
	for(i := 0; i < LENGTH/2; i++)
		b[i] = sin(real i * 2.0 * Pi / real LENGTH);
	return b;
}

sinewave(): array of real
{
	b := array[LENGTH] of { * => 0.0};
	for(i := 0; i < LENGTH; i++)
		b[i] = sin(real i * 2.0 * Pi / real LENGTH);
	return b;
}

sineblnk(): array of real
{
	b := sinewave();
	for(i := 0; i < LENGTH/2; i++)
		b[i] = b[2*i];
	for(i = LENGTH/2; i < LENGTH; i++)
		b[i] = 0.0;
	return b;
}

fwavblnk(): array of real
{
	b := sineblnk();
	for(i:=0;i<LENGTH/4;i++)
		b[i+LENGTH/4] = b[i];
	return b;
}

impuls(n: int): array of real
{
	b := array[LENGTH] of real;
	for(i := 0; i < LENGTH; i++){
		t := 0.0;
		for(j := 1; j <= n; j++)
			t += cos(real i * real j * 2.0 * Math->Pi / real LENGTH);
		b[i] = t * real n;
	}
	return b;
}

noise(): array of real
{
	b := array[LENGTH] of real;
	MAX := 65536;
	for(i := 0; i < LENGTH; i++)
		b[i] = 2.0 * real rand->rand(MAX) / real(MAX + 1);
	return b;
}

# generic utils

